package com.baizhi.service.impl;

import org.apache.ibatis.session.SqlSession;

import com.baizhi.dao.UsersDao;
import com.baizhi.entity.Users;
import com.baizhi.service.UsersService;
import com.baizhi.util.MyBatisUtils;

public class UsersServiceImpl implements UsersService {
	@Override
	public Users login(Users users) {
		SqlSession sqlSession = null;
		try {
			sqlSession = MyBatisUtils.getSqlSession();
			UsersDao ud=sqlSession.getMapper(UsersDao.class);
			users=ud.selectUser(users);
			sqlSession.commit();
		} catch (Exception e) {
			e.printStackTrace();
			sqlSession.rollback();
		}finally{
			MyBatisUtils.close(sqlSession);
		}
		return users;
	}
}
